<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

//添加好友关系表
class ProjectShare extends Model
{
    //
    protected $table = 'project_share';
    protected $fillable = [
        'user_id',
        'project_id',
        'created_at',
        'updated_at',
        'permission_id',
        'type',
        'target'
    ];

    const TYPE = [
        0 =>'用户', //默认
        1 => '组'
    ];

    const PERMISSION_TYPE = [
        1 => '读',
        2 => '读写',
        3 => '读写分享',
        4 => '读写不可分享'
    ];

    public function user(){
        return $this->belongsTo(User::class);
    }

    //权限判断,目前没有组
    public function checkPermission()
    {

    }
}
